package com.train.user.service.impl;

import java.util.List;
import com.train.common.utils.DateUtils;
import com.train.user.domain.SysNotification;
import com.train.user.mapper.SysNotificationMapper;
import com.train.user.service.SysNotificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 系统通知Service业务层处理
 * 
 * @author train
 * @date 2025-10-27
 */
@Service
public class SysNotificationServiceImpl implements SysNotificationService
{
    @Autowired
    private SysNotificationMapper sysNotificationMapper;

    /**
     * 查询系统通知
     * 
     * @param notificationId 系统通知主键
     * @return 系统通知
     */
    @Override
    public SysNotification selectSysNotificationByNotificationId(Long notificationId)
    {
        return sysNotificationMapper.selectSysNotificationByNotificationId(notificationId);
    }

    /**
     * 查询系统通知列表
     * 
     * @param sysNotification 系统通知
     * @return 系统通知
     */
    @Override
    public List<SysNotification> selectSysNotificationList(SysNotification sysNotification)
    {
        return sysNotificationMapper.selectSysNotificationList(sysNotification);
    }

    /**
     * 新增系统通知
     * 
     * @param sysNotification 系统通知
     * @return 结果
     */
    @Override
    public int insertSysNotification(SysNotification sysNotification)
    {
        sysNotification.setCreateTime(DateUtils.getNowDate());
        return sysNotificationMapper.insertSysNotification(sysNotification);
    }

    /**
     * 修改系统通知
     * 
     * @param sysNotification 系统通知
     * @return 结果
     */
    @Override
    public int updateSysNotification(SysNotification sysNotification)
    {
        sysNotification.setUpdateTime(DateUtils.getNowDate());
        return sysNotificationMapper.updateSysNotification(sysNotification);
    }

    /**
     * 批量删除系统通知
     * 
     * @param notificationIds 需要删除的系统通知主键
     * @return 结果
     */
    @Override
    public int deleteSysNotificationByNotificationIds(Long[] notificationIds)
    {
        return sysNotificationMapper.deleteSysNotificationByNotificationIds(notificationIds);
    }

    /**
     * 删除系统通知信息
     * 
     * @param notificationId 系统通知主键
     * @return 结果
     */
    @Override
    public int deleteSysNotificationByNotificationId(Long notificationId)
    {
        return sysNotificationMapper.deleteSysNotificationByNotificationId(notificationId);
    }
}
